<?php
namespace Common\Model;
use Think\Model;

class PushModel extends Model{
    protected $tableName = 'push_history';
    protected $pk        = 'push_history_id';
	protected $_validate = array(
            array('title', '1,100', '推送标题长度有误', self::MUST_VALIDATE, 'length', 3),    
            array('content', '1,500', '推送内容长度有误', self::MUST_VALIDATE, 'length', 3),
		);

    public function getErrorCodeMsg($code = null){
        $codeMsgArray = array(
            '30600' =>  '30600服务内部错误',
            '30601' =>  '30601请求方法不允许',
            '30602' =>  '30602请求参数错误',
            '30603' =>  '30603权限验证失败',
            '30604' =>  '30604配额用尽需要续费',
            '30605' =>  '30605请求数据不存在',
            '30606' =>  '30606请求时间戳验证超时',
            '30607' =>  '30607服务令牌有效期超时',
            '30608' =>  '30608绑定关系未找到或不存在',
            '30609' =>  '30609绑定关系太多',
            '30610' =>  '30610重复操作',
            '30611' =>  '30611Tag未找到或不存在',
            '30612' =>  '30612应用被禁止，需要白名单授权',
            '30613' =>  '30613需要先在Push-Console开通推送功能',
            '30616' =>  '30616未审核通过，应用无法使用推送服务',
            '30617' =>  '30617应用没有广播推送能力',
            '30618' =>  '30618应用没有单播或组播推送能力',
            '30619' =>  '30619不允许操作',
            '30620' =>  '30620一个应用只支持一个设备平台',
            '30621' =>  '30621android包名非法',
            '30699' =>  '30699请求太频繁而被临时拒绝或者需要白名单授权',
            '40001' =>  '40001iOSDevice Token格式不合法',
            '40002' =>  '40002iOS无效的消息格式',
            '40003' =>  '40003iOSAPNS认为Device Token已经失效',
            '40004' =>  '40004iOS证书错误，连接被APNs拒绝',
            '40005' =>  '40005iOS重复消息',
            '40006' =>  '40006iOS生产版证书无效',
            '40007' =>  '40007iOS开发版证书无效',
            '40008' =>  '40008iOS生产版证书过期',
            '40009' =>  '40009iOS开发版证书过期',
            '40010' =>  '40010需要开发版证书，错误上传了生产版证书',
            '40011' =>  '40011需要生产版证书，错误上传了生产版证书',
            '40012' =>  '40012iOS证书不合法',
            '41001' =>  '41001定时任务不存在',
            '41002' =>  '41002定时任务重复',
            '41003' =>  '41003定时任务数超限',
            '41004' =>  '41004定时任务将要执行，不允许取消',
            '41005' =>  '41005定时任务已执行',
            '50001' =>  '50001生成CSRF Token失败',
            '50002' =>  '50002无效的CSRF Token',
            '50003' =>  '50003CSRF Token已失效',
            '50004' =>  '50004未登录百度账号',
            '50005' =>  '50005无效的baidu账户',
            '50006' =>  '50006不是开发者',
            '50007' =>  '50007开发者无效',
            '50008' =>  '50008应用名非法'
        );
        if(!empty($code)) {
            return $codeMsgArray[$code];
        }
    }
}
